﻿// Copyright (c) 2014 Bryan C. O'Connell
// http://wsubi.codeplex.com/license
// Purpose: Defines the 'roll' command. Roll gathers information on scripts which is used by other commands.

using System;
using Wsubi.Code.Utilities;

namespace Wsubi.Code.Commands
{
    public class Roll : ICommand
    {
        public string Target { get; set; }
        public string Params { get; set; }
        public ScriptData ScriptDataStorage { get; set; }

        private ResultSet _Results;

        public string GetActionKeyword() {
            return "roll";
        }

        public ResultSet Execute()
        {
            Guard.CheckForNullObject(ScriptDataStorage);
            string ScriptsFolder = ScriptDataStorage.ShareScriptsFolder();
            ScriptDataStorage.BuildDataStores(ScriptsFolder);
            
            BuildResultSet();
            return _Results;
        }

        private void BuildResultSet()
        {
            _Results = new ResultSet();
            _Results.AddResult("Scripts have been re-rolled.");
            _Results.OutputTo = OutputsTo.Screen;
        }
    }
}
